﻿<UserControl x:Class="ViewRessources"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:OMANE.Modules.Dashboarding"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock Margin="5" Text="Filtres :" />
        <ListBox Padding="0" Margin="0" ScrollViewer.CanContentScroll="False"  ItemsSource="{Binding Ressources}" Grid.Row="1" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <DockPanel Width="150" Height="150" Margin="2">
                        <TextBlock Text="{Binding Key}"  DockPanel.Dock="Top" Margin="2" Padding="2" TextTrimming="CharacterEllipsis" />

                        <Border DockPanel.Dock="Bottom" BorderBrush="Black" CornerRadius="5" BorderThickness="1">
                            <ContentControl Content="{Binding}" Margin="10" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" >
                                <ContentControl.ContentTemplateSelector>
                                    <local:ViewRessourcesTemplateSelector  />
                                </ContentControl.ContentTemplateSelector>
                            </ContentControl>
                        </Border>
                    </DockPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <UniformGrid HorizontalAlignment="Left" VerticalAlignment="Top"   />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>
</UserControl>
